#include <iostream>
#include <string>


using namespace std;

int main()
{
    int c = 0;
    string s;
    string stek = "";
    s = "()()(())";
    for (char i: s){
        if (i == '(') stek = stek + i;
        else
        if (stek[stek.length()-1] == '(') stek.pop_back();
    }
    if (stek.length() == 0)
        cout << "true";
    else cout << "false";
}
